package com.ruicar.afs.cloud.bizcommon.print.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruicar.afs.cloud.bizcommon.dto.print.TemplateDto;
import com.ruicar.afs.cloud.bizcommon.print.entity.ComPrintFormManage;
import com.ruicar.afs.cloud.common.core.query.QueryCondition;
import com.ruicar.afs.cloud.common.core.util.IResponse;
import com.ruicar.afs.cloud.common.rules.dto.RuleResult;
import com.ruicar.afs.cloud.image.entity.ComAttachmentFile;

import java.util.List;

/**
 * 打印模板管理表
 *
 * @author phong
 * @version 1.0
 * @created 2020/6/8 11:40
 */
public interface ComPrintFormManageService extends IService<ComPrintFormManage> {

    /**
     * 单个模板打印
     *  @param originJson 原数据
     * @param id         模板ID
     */
    public ComAttachmentFile print(JSONObject originJson, String id, String applyNo, String serviceClientType);

    /**
     * 通过原数据进行模板打印
     *
     * @param originJson
     * @param ruleJson
     * @param applyNo
     * @param belongNo
     * @return
     */
    public String print(JSONObject originJson, JSONObject ruleJson, String applyNo, String belongNo);

    /**
     * 通过规则进行模板打印 - 批量文件
     *
     * @param originJson
     * @param ruleJson
     * @param applyNo
     * @param groupId
     * @return
     */
    public List<ComAttachmentFile> batchPrint(JSONObject originJson, JSONObject ruleJson, String applyNo, String groupId, String serviceClientType);

    /**
     * 当个模板生成-测试类
     * @param originJson
     * @param filePath
     * @param fileName
     */
    public void testPrint(JSONObject originJson,String filePath,String fileName);

    /**
     * 生成盖章文件
     * @param file
     * @return
     */
    public ComAttachmentFile generateSealFile(ComAttachmentFile file);

    /*--------------------------------内部使用--------------------------------------*/
    Boolean saveTemplate(ComPrintFormManage comPrintFormManage);

    Boolean delTemplate(String id);

    Boolean modifyTemplate(ComPrintFormManage comPrintFormManage);

    IResponse query(QueryCondition<TemplateDto> queryCondition);

    String preview(String printFormId);

    List<RuleResult> queryIdByRule(JSONObject runParams);

    public List<RuleResult> queryIdByRule(JSONObject runParams, String ruleNo);

    /**
     * 通过uniqueCode获取模板
     * @param uniqueCode
     * @return
     */
    public ComPrintFormManage getPrintFormManageByUniqueCode(String uniqueCode);

}
